package com.zhuozhou.jdyc.main.meinfo.adapter;

import android.content.Context;

import com.zhuozhou.jdyc.R;
import com.zhuozhou.jdyc.base.BaseRecyclerViewAdapter;
import com.zhuozhou.jdyc.base.BaseViewHolder;
import com.zhuozhou.jdyc.databinding.AdapterWalletBinding;
import com.zhuozhou.jdyc.main.meinfo.bean.WalletBean;

/**
 * Create by CherishTang on 2020/3/27 0027
 * describe:首页菜单adapter
 */
public class WalletAdapter extends BaseRecyclerViewAdapter<WalletBean.ListBean, AdapterWalletBinding> {
    private int type;

    public WalletAdapter(Context context) {
        super(context);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.adapter_wallet;
    }


    @Override
    public void onBindHolder(BaseViewHolder<AdapterWalletBinding> holder, int pos) {
        switch (type) {
            case 0:
                if (mList.get(pos).getType() == 2) {
                    holder.getBinding().title.setText("积分收益");
                    holder.getBinding().tvMoney.setText("=" + mList.get(pos).getPrice() + "积分");
                } else if (mList.get(pos).getType() == 3) {
                    holder.getBinding().title.setText("易货积分收益");
                    holder.getBinding().tvMoney.setText("=" + mList.get(pos).getPrice() + "易货积分");
                } else {
                    holder.getBinding().title.setText("提成收益");
                    holder.getBinding().tvMoney.setText("=" + mList.get(pos).getPrice() + "元");
                }
                break;
            case 1:
                holder.getBinding().title.setText("待提成");
                holder.getBinding().tvMoney.setText("=" + mList.get(pos).getPrice() + "元");
                break;
            case 2:
                holder.getBinding().title.setText("积分收益");
                holder.getBinding().tvMoney.setText("=" + mList.get(pos).getPrice() + "积分");
                break;
            case 3:
                holder.getBinding().title.setText("易货积分收益");
                holder.getBinding().tvMoney.setText("=" + mList.get(pos).getPrice() + "易货积分");
                break;
            case 4:
                holder.getBinding().title.setText("已提成收益");
                holder.getBinding().tvMoney.setText("=" + mList.get(pos).getPrice() + "元");
                break;
        }
        holder.getBinding().tvName.setText("来自" + mList.get(pos).getNickname() + "订单");
        holder.getBinding().tvData.setText(mList.get(pos).getUpdatetime() + "");
    }

    public void setType(int type) {
        this.type = type;
    }
}
